package com.wanxi.service.front.impl;

import com.wanxi.dao.front.FootDao;
import com.wanxi.dao.front.HomeDao;
import com.wanxi.dao.front.NavDao;
import com.wanxi.domain.front.FootInfoModel;
import com.wanxi.domain.front.TopInfoModel;
import com.wanxi.domain.front.TopNavModel;
import com.wanxi.domain.product.ProductModel;
import com.wanxi.service.front.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HomeServiceImpl implements HomeService {

    @Autowired
    private HomeDao homeDao;
    @Autowired
    private FootDao footDao;
    @Autowired
    private NavDao navDao;

    //获取首页顶部信息
    @Override
    public List<TopInfoModel> getTopInfo() {
        List<TopInfoModel> topInfos = homeDao.getTopInfo();
       /* ResultModel resultModel = new ResultModel();
        resultModel.setData(topInfos);*/
        return topInfos;
    }

    /*获取首页导航栏信息*/
    @Override
    public  List<TopNavModel>  getNavInfo() {
        List<TopNavModel> all = homeDao.getNavInfo();

       /* ResultModel resultModel = new ResultModel();

        resultModel.setData(all);*/

        return all;
    }

    /*获取首页底部信息*/
    @Override
    public List<FootInfoModel> getFootInfo() {
        List<FootInfoModel> all = homeDao.getFootInfo();

        /*ResultModel resultModel = new ResultModel();

        resultModel.setData(all);*/

        return all;
    }

    @Override
    public int insertNav(TopNavModel topNavModel) {
        int num = homeDao.insertNav(topNavModel);
        return  num;
    }

    @Override
    public int deleteNavByTitle(int id) {
        int num = homeDao.deleteNavByTitle(id);

      /*  ResultModel resultModel = new ResultModel();
        resultModel.setCount(num);*/

        return num;
    }

    @Override
    public int insertFoot(FootInfoModel footInfoModel) {
        int num = homeDao.insertFoot(footInfoModel);
        return  num;
    }

    @Override
    public int deleteFootByTitle(int id) {
        int num = homeDao.deleteFootByTitle(id);

      /*  ResultModel resultModel = new ResultModel();
        resultModel.setCount(num);*/

        return num;
    }

    @Override
    public int updateNav(TopNavModel navModel) {
        int num = homeDao.updateNav(navModel);
        return num;
    }

    @Override
    public int updateFoot(FootInfoModel footInfoModel) {
        int num = homeDao.updateFoot(footInfoModel);
        return num;
    }

    @Override
    public TopNavModel findNavById(Integer id) {
        TopNavModel topNavModel = navDao.findNavById(id);
        return topNavModel;
    }

    @Override
    public FootInfoModel findFootById(Integer id) {
        FootInfoModel footInfoModel=footDao.findFootById(id);
        return null;
    }
}
